# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Llewelyn Trahaearn <WoefulDerelict [at] GMail [dot] com>
# Contributor: falkTX <falktx [at] gmail [dot] com>

_name=Carla
pkgname=carla
_commit=077cebf57203875d4312dca6f79c2062d8009b61  # refs/tags/v2.5.7
pkgver=2.5.7
pkgrel=1
pkgdesc="Audio Plugin Host"
arch=(loong64 x86_64)
url="https://kxstudio.linuxaudio.org/Applications:Carla"
license=(GPL-2.0-or-later)
groups=(pro-audio)
depends=(
  gcc-libs
  glibc
  hicolor-icon-theme
  libx11
  python
  python-pyqt5
  python-pyliblo
  python-rdflib
  qt5-base
  qt5-svg
  sdl2
  sh
)
makedepends=(
  alsa-lib
  file
  fluidsynth
  freetype2
  git
  libglvnd
  liblo
  libpulse
  libsndfile
  python-requests
  python-tornado
  qt5-tools
)
optdepends=(
  'jack: for using carla with JACK'
  'lv2-host: for the LV2 plugin'
  'vst-host: for the VST plugin'
  'python-requests: for qtweb backend'
  'python-tornado: for MOD UI'
)
provides=(
  dssi-host
  ladspa-host
  lv2-host
  vst-host
  vst3-host
)
source=(git+https://github.com/falkTX/$pkgname#tag=$_commit?signed)
sha512sums=('SKIP')
b2sums=('SKIP')
validpgpkeys=(62B11043D2F6EB6672D93103CDBAA37ABC74FBA0)  # falkTX <falktx@falktx.com>

pkgver() {
  cd $pkgname
  git describe --tag | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//g'
}

build() {
  make features -C $pkgname
  make -C $pkgname
}

package() {
  depends+=(
    alsa-lib libasound.so
    file libmagic.so
    fluidsynth libfluidsynth.so
    freetype2 libfreetype.so
    libglvnd libGL.so
    liblo liblo.so
    libpulse libpulse.so libpulse-simple.so
    libsndfile libsndfile.so
  )

  make DEFAULT_QT=5 DESTDIR="$pkgdir" PREFIX=/usr install -C $pkgname
  install -vDm 644 $pkgname/README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  find "$pkgdir" -type f -iname "*.so" -exec chmod +x {} +
}
# vim:set ts=2 sw=2 et:
